<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>couchdbkit.schema</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="couchdbkit-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="couchdbkit-module.html">Package&nbsp;couchdbkit</a> ::
        Package&nbsp;schema
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="couchdbkit.schema-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="couchdbkit.schema-module.html">Package couchdbkit.schema</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: utf-8 -</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># This file is part of couchdbkit released under the MIT license.</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># See the NOTICE for more information.</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">"""\</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">Schema is an easy way to map couchdb object in pythoin object. It's</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring">similar to ORMs but with all couchdb glory.</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">An application describes the kinds of data it uses with a Document object. A</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">document is a Python class that inherits from the `couchdbkit.schema.Document`</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring">class. The document class defines a new kind of CouchDB document and the</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">properties the kind is expected to take.</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">Document properties are defined using class attributes on the document class.</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">Each class attribute is an instance of a subclass of the Property class,</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">usually one of the provided property classes. A property instance holds</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">configuration for the property, such as whether or not the property is required</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">for the instance to be valid, or a default value to use for the instance if</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">none is provided.</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">    from couchdbkit import Document</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    class Pet(Document):</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">        name = schema.StringProperty(required=True)</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">        type = schema.StringProperty(required=True)</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">        birthdate = schema.DateProperty()</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">        weight_in_pounds = schema.IntegerProperty()</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">        spayed_or_neutered = schema.BooleanProperty()</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">        owner = schema.StringProperty()</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">An CouchDB document is represented in the API by an instance of the</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">corresponding document class. The application can create a new document by</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">calling the constructor of the class. The application accesses and manipulates</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">properties of the entity using attributes of the instance. The document</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring">instance constructor accepts initial values for properties as keyword</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">arguments.</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    pet = Pet(name="Fluffy",</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">          type="cat",</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">          owner="Jean")</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">    pet.weight_in_pounds = 24</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">Document is dynamic</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring">-------------------</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-docstring">Sometimes it is usefull to have different properties on each document. CouchDB</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-docstring">allows it, so why not having it in python. A document can have both dynamic and</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">static property. Any value assigned to an attribute of an instance of a</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-docstring">document becomes a property of the CouchDB document, using the name of the</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-docstring">attribute. These properties are known as dynamic properties. Properties defined</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-docstring">using Property class instances in class attributes are fixed properties.</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-docstring">    class Person(Document):</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-docstring">        first_name = schema.StringProperty()</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">        last_name = schema.StringProperty()</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring">        hobbies = schema.ListProperty()</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">    p = Person(first_name="Albert", last_name="Johnson")</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">    p.hobbies = ["chess", "travel"]</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">    p.chess_elo_rating = 1350</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-docstring">    p.travel_countries_visited = ["Spain", "Italy", "USA", "Brazil"]</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-docstring">    p.travel_trip_count = 13</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-docstring">Because dynamic properties do not have document property definitions, dynamic</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring">properties are not validated. Any dynamic property can have a value of any of</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">the python types, including None.</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-docstring">Unlike fixed properties, dynamic properties need not exist. A dynamic property</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-docstring">with a value of None is different from a non-existent dynamic property.  You</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-docstring">can delete a dynamic property by deleting the attribute.</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt class="py-docstring">    del p.chess_elo_rating</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-docstring">A request that uses a dynamic property will only return entities whose value</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-docstring">for the property is of the same type as the value used in the request.</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-docstring">Similarly, the request will only return entities with that property set.</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-docstring">    p1 = Person()</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-docstring">    p1.favorite = 42</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-docstring">    db.save_doc(p1)</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-docstring">    p2 = Person()</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"><tt class="py-docstring">    p2.favorite = "blue"</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"><tt class="py-docstring">    db.save_doc(p2)</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">    p3 = Person()</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring">    db.save_doc(p3)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"><tt class="py-docstring">    people = Person.view(db, "person/favorite", startkey=0, endkey=50)</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-docstring">    # people has p1, but not p2 or p3</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"><tt class="py-docstring">    people = Person.view(db, "person/favorite")", startkey=50)</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"><tt class="py-docstring">    # people has no results</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"><tt class="py-docstring">Some dynamic data in couchdb are automatically converted to their python type.</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line"><tt class="py-docstring">Those are datetime, datetime.date, datetime.time and Decimal types. this is</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"><tt class="py-docstring">only possible if date/time fields are :rfc:`8601` strings in the couchdb</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"><tt class="py-docstring">document.</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line"><tt class="py-docstring">Document inheritance in simplecouchdb work almost identically to the way normal</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"><tt class="py-docstring">class inheritance works in Python.</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line"><tt class="py-docstring">    class Animal(Document)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"><tt class="py-docstring">        name = StringProperty(required=True)</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line"><tt class="py-docstring">        type = StringProperty(required=True)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line"><tt class="py-docstring">    class Pet(Animal):</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-docstring">        birthdate = DateProperty()</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line"><tt class="py-docstring">        weight_in_pounds = IntegerProperty()</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"><tt class="py-docstring">        spayed_or_neutered = BooleanProperty()</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"><tt class="py-docstring">        owner = StringProperty()</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line"><tt class="py-docstring">The `Pet` document will have 6 properties name, type, birthdate,</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line"><tt class="py-docstring">weight_in_pounds, spayed_or_neutered, owner. It can be used as a common</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line"><tt class="py-docstring">Document object. Pet and Animal have 2 different doc_type.</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line"><tt class="py-docstring">For now, there is no way in CouchDB to know that Pet inherit from Animal.</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"><tt class="py-docstring">Though this feature will be implemented soon.</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"><tt class="py-docstring">Properties and Types</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line"><tt class="py-docstring">--------------------</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"><tt class="py-docstring">Couchdb supports all Javascript types, including Unicode strings, integers,</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"><tt class="py-docstring">floating point numbers. We also added support for dates and decimal types. Each</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"><tt class="py-docstring">of the CouchDB value type has a corresponding Property class provided by the</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"><tt class="py-docstring">:mod:`simplecouchdb.schema` module.</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">Other way to save on the db.</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">----------------------------</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">If you don't want to use the db object to save doc each time and save</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"><tt class="py-docstring">&#224;la "ORM" you can fix a db to a Document class::</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"><tt class="py-docstring">    class A(Dcoument):</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"><tt class="py-docstring">        s = StringProperty()</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">    A.set_db(db)</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">    a = A()</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">    a.save()</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line"><tt class="py-docstring">This method isn't really threadsafe since once class will share a db</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line"><tt class="py-docstring">reference across threads, changing a db to a class will be applied to</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line"><tt class="py-docstring">all threads. It's better to use the db object methods if you want to be</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"><tt class="py-docstring">threadsafe.</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Class Method couchdbkit.schema.base.DocumentSchema.properties()=couchdbkit.schema.base.DocumentSchema-class.html#properties,Module couchdbkit.schema.properties=couchdbkit.schema.properties-module.html"><a title="couchdbkit.schema.base.DocumentSchema.properties
couchdbkit.schema.properties" class="py-name" href="#" onclick="return doclink('link-0', 'properties', 'link-0');">properties</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">(</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">        <tt id="link-1" class="py-name" targets="Variable couchdbkit.schema.base.ALLOWED_PROPERTY_TYPES=couchdbkit.schema.base-module.html#ALLOWED_PROPERTY_TYPES,Variable couchdbkit.schema.properties.ALLOWED_PROPERTY_TYPES=couchdbkit.schema.properties-module.html#ALLOWED_PROPERTY_TYPES"><a title="couchdbkit.schema.base.ALLOWED_PROPERTY_TYPES
couchdbkit.schema.properties.ALLOWED_PROPERTY_TYPES" class="py-name" href="#" onclick="return doclink('link-1', 'ALLOWED_PROPERTY_TYPES', 'link-1');">ALLOWED_PROPERTY_TYPES</a></tt><tt class="py-op">,</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">        <tt id="link-2" class="py-name" targets="Class couchdbkit.schema.properties.Property=couchdbkit.schema.properties.Property-class.html"><a title="couchdbkit.schema.properties.Property" class="py-name" href="#" onclick="return doclink('link-2', 'Property', 'link-2');">Property</a></tt><tt class="py-op">,</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">        <tt id="link-3" class="py-name" targets="Class couchdbkit.schema.properties.StringProperty=couchdbkit.schema.properties.StringProperty-class.html"><a title="couchdbkit.schema.properties.StringProperty" class="py-name" href="#" onclick="return doclink('link-3', 'StringProperty', 'link-3');">StringProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">        <tt id="link-4" class="py-name" targets="Class couchdbkit.schema.properties.IntegerProperty=couchdbkit.schema.properties.IntegerProperty-class.html"><a title="couchdbkit.schema.properties.IntegerProperty" class="py-name" href="#" onclick="return doclink('link-4', 'IntegerProperty', 'link-4');">IntegerProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">        <tt id="link-5" class="py-name" targets="Class couchdbkit.schema.properties.DecimalProperty=couchdbkit.schema.properties.DecimalProperty-class.html"><a title="couchdbkit.schema.properties.DecimalProperty" class="py-name" href="#" onclick="return doclink('link-5', 'DecimalProperty', 'link-5');">DecimalProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">        <tt id="link-6" class="py-name" targets="Class couchdbkit.schema.properties.BooleanProperty=couchdbkit.schema.properties.BooleanProperty-class.html"><a title="couchdbkit.schema.properties.BooleanProperty" class="py-name" href="#" onclick="return doclink('link-6', 'BooleanProperty', 'link-6');">BooleanProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">        <tt id="link-7" class="py-name" targets="Class couchdbkit.schema.properties.FloatProperty=couchdbkit.schema.properties.FloatProperty-class.html"><a title="couchdbkit.schema.properties.FloatProperty" class="py-name" href="#" onclick="return doclink('link-7', 'FloatProperty', 'link-7');">FloatProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">        <tt id="link-8" class="py-name" targets="Class couchdbkit.schema.properties.DateTimeProperty=couchdbkit.schema.properties.DateTimeProperty-class.html"><a title="couchdbkit.schema.properties.DateTimeProperty" class="py-name" href="#" onclick="return doclink('link-8', 'DateTimeProperty', 'link-8');">DateTimeProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">        <tt id="link-9" class="py-name" targets="Class couchdbkit.schema.properties.DateProperty=couchdbkit.schema.properties.DateProperty-class.html"><a title="couchdbkit.schema.properties.DateProperty" class="py-name" href="#" onclick="return doclink('link-9', 'DateProperty', 'link-9');">DateProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">        <tt id="link-10" class="py-name" targets="Class couchdbkit.schema.properties.TimeProperty=couchdbkit.schema.properties.TimeProperty-class.html"><a title="couchdbkit.schema.properties.TimeProperty" class="py-name" href="#" onclick="return doclink('link-10', 'TimeProperty', 'link-10');">TimeProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt id="link-11" class="py-name" targets="Class couchdbkit.schema.properties.DictProperty=couchdbkit.schema.properties.DictProperty-class.html"><a title="couchdbkit.schema.properties.DictProperty" class="py-name" href="#" onclick="return doclink('link-11', 'DictProperty', 'link-11');">DictProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">        <tt id="link-12" class="py-name" targets="Class couchdbkit.schema.properties.ListProperty=couchdbkit.schema.properties.ListProperty-class.html"><a title="couchdbkit.schema.properties.ListProperty" class="py-name" href="#" onclick="return doclink('link-12', 'ListProperty', 'link-12');">ListProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">        <tt id="link-13" class="py-name" targets="Class couchdbkit.schema.properties.StringListProperty=couchdbkit.schema.properties.StringListProperty-class.html"><a title="couchdbkit.schema.properties.StringListProperty" class="py-name" href="#" onclick="return doclink('link-13', 'StringListProperty', 'link-13');">StringListProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">        <tt id="link-14" class="py-name" targets="Class couchdbkit.schema.properties.SetProperty=couchdbkit.schema.properties.SetProperty-class.html"><a title="couchdbkit.schema.properties.SetProperty" class="py-name" href="#" onclick="return doclink('link-14', 'SetProperty', 'link-14');">SetProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">        <tt id="link-15" class="py-name" targets="Function couchdbkit.schema.properties.dict_to_json()=couchdbkit.schema.properties-module.html#dict_to_json"><a title="couchdbkit.schema.properties.dict_to_json" class="py-name" href="#" onclick="return doclink('link-15', 'dict_to_json', 'link-15');">dict_to_json</a></tt><tt class="py-op">,</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt id="link-16" class="py-name" targets="Function couchdbkit.schema.properties.list_to_json()=couchdbkit.schema.properties-module.html#list_to_json"><a title="couchdbkit.schema.properties.list_to_json" class="py-name" href="#" onclick="return doclink('link-16', 'list_to_json', 'link-16');">list_to_json</a></tt><tt class="py-op">,</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">        <tt id="link-17" class="py-name" targets="Function couchdbkit.schema.properties.value_to_json()=couchdbkit.schema.properties-module.html#value_to_json"><a title="couchdbkit.schema.properties.value_to_json" class="py-name" href="#" onclick="return doclink('link-17', 'value_to_json', 'link-17');">value_to_json</a></tt><tt class="py-op">,</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">        <tt id="link-18" class="py-name" targets="Variable couchdbkit.schema.properties.MAP_TYPES_PROPERTIES=couchdbkit.schema.properties-module.html#MAP_TYPES_PROPERTIES"><a title="couchdbkit.schema.properties.MAP_TYPES_PROPERTIES" class="py-name" href="#" onclick="return doclink('link-18', 'MAP_TYPES_PROPERTIES', 'link-18');">MAP_TYPES_PROPERTIES</a></tt><tt class="py-op">,</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">        <tt id="link-19" class="py-name" targets="Function couchdbkit.schema.properties.value_to_python()=couchdbkit.schema.properties-module.html#value_to_python"><a title="couchdbkit.schema.properties.value_to_python" class="py-name" href="#" onclick="return doclink('link-19', 'value_to_python', 'link-19');">value_to_python</a></tt><tt class="py-op">,</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">        <tt id="link-20" class="py-name" targets="Function couchdbkit.schema.properties.dict_to_python()=couchdbkit.schema.properties-module.html#dict_to_python"><a title="couchdbkit.schema.properties.dict_to_python" class="py-name" href="#" onclick="return doclink('link-20', 'dict_to_python', 'link-20');">dict_to_python</a></tt><tt class="py-op">,</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">        <tt id="link-21" class="py-name" targets="Function couchdbkit.schema.properties.list_to_python()=couchdbkit.schema.properties-module.html#list_to_python"><a title="couchdbkit.schema.properties.list_to_python" class="py-name" href="#" onclick="return doclink('link-21', 'list_to_python', 'link-21');">list_to_python</a></tt><tt class="py-op">,</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">        <tt id="link-22" class="py-name" targets="Function couchdbkit.schema.properties.convert_property()=couchdbkit.schema.properties-module.html#convert_property"><a title="couchdbkit.schema.properties.convert_property" class="py-name" href="#" onclick="return doclink('link-22', 'convert_property', 'link-22');">convert_property</a></tt><tt class="py-op">,</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">        <tt id="link-23" class="py-name" targets="Function couchdbkit.schema.properties.value_to_property()=couchdbkit.schema.properties-module.html#value_to_property"><a title="couchdbkit.schema.properties.value_to_property" class="py-name" href="#" onclick="return doclink('link-23', 'value_to_property', 'link-23');">value_to_property</a></tt><tt class="py-op">,</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">        <tt id="link-24" class="py-name" targets="Class couchdbkit.schema.properties.LazyDict=couchdbkit.schema.properties.LazyDict-class.html"><a title="couchdbkit.schema.properties.LazyDict" class="py-name" href="#" onclick="return doclink('link-24', 'LazyDict', 'link-24');">LazyDict</a></tt><tt class="py-op">,</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">        <tt id="link-25" class="py-name" targets="Class couchdbkit.schema.properties.LazyList=couchdbkit.schema.properties.LazyList-class.html"><a title="couchdbkit.schema.properties.LazyList" class="py-name" href="#" onclick="return doclink('link-25', 'LazyList', 'link-25');">LazyList</a></tt><tt class="py-op">)</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="couchdbkit.schema.base.DocumentSchema.properties
couchdbkit.schema.properties" class="py-name" href="#" onclick="return doclink('link-26', 'properties', 'link-0');">properties</a></tt> <tt class="py-keyword">import</tt> <tt id="link-27" class="py-name"><a title="couchdbkit.schema.properties.SetProperty" class="py-name" href="#" onclick="return doclink('link-27', 'SetProperty', 'link-14');">SetProperty</a></tt><tt class="py-op">,</tt> <tt id="link-28" class="py-name" targets="Class couchdbkit.schema.properties.LazySet=couchdbkit.schema.properties.LazySet-class.html"><a title="couchdbkit.schema.properties.LazySet" class="py-name" href="#" onclick="return doclink('link-28', 'LazySet', 'link-28');">LazySet</a></tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Module couchdbkit.consumer.base=couchdbkit.consumer.base-module.html,Module couchdbkit.schema.base=couchdbkit.schema.base-module.html"><a title="couchdbkit.consumer.base
couchdbkit.schema.base" class="py-name" href="#" onclick="return doclink('link-29', 'base', 'link-29');">base</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">(</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">        <tt id="link-30" class="py-name" targets="Class couchdbkit.exceptions.ReservedWordError=couchdbkit.exceptions.ReservedWordError-class.html"><a title="couchdbkit.exceptions.ReservedWordError" class="py-name" href="#" onclick="return doclink('link-30', 'ReservedWordError', 'link-30');">ReservedWordError</a></tt><tt class="py-op">,</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">        <tt id="link-31" class="py-name"><a title="couchdbkit.schema.base.ALLOWED_PROPERTY_TYPES
couchdbkit.schema.properties.ALLOWED_PROPERTY_TYPES" class="py-name" href="#" onclick="return doclink('link-31', 'ALLOWED_PROPERTY_TYPES', 'link-1');">ALLOWED_PROPERTY_TYPES</a></tt><tt class="py-op">,</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">        <tt id="link-32" class="py-name" targets="Class couchdbkit.schema.base.DocumentSchema=couchdbkit.schema.base.DocumentSchema-class.html"><a title="couchdbkit.schema.base.DocumentSchema" class="py-name" href="#" onclick="return doclink('link-32', 'DocumentSchema', 'link-32');">DocumentSchema</a></tt><tt class="py-op">,</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">        <tt id="link-33" class="py-name" targets="Class couchdbkit.schema.base.SchemaProperties=couchdbkit.schema.base.SchemaProperties-class.html"><a title="couchdbkit.schema.base.SchemaProperties" class="py-name" href="#" onclick="return doclink('link-33', 'SchemaProperties', 'link-33');">SchemaProperties</a></tt><tt class="py-op">,</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">        <tt id="link-34" class="py-name" targets="Class couchdbkit.schema.base.DocumentBase=couchdbkit.schema.base.DocumentBase-class.html"><a title="couchdbkit.schema.base.DocumentBase" class="py-name" href="#" onclick="return doclink('link-34', 'DocumentBase', 'link-34');">DocumentBase</a></tt><tt class="py-op">,</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt id="link-35" class="py-name" targets="Class couchdbkit.schema.base.QueryMixin=couchdbkit.schema.base.QueryMixin-class.html"><a title="couchdbkit.schema.base.QueryMixin" class="py-name" href="#" onclick="return doclink('link-35', 'QueryMixin', 'link-35');">QueryMixin</a></tt><tt class="py-op">,</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt id="link-36" class="py-name" targets="Class couchdbkit.schema.base.AttachmentMixin=couchdbkit.schema.base.AttachmentMixin-class.html"><a title="couchdbkit.schema.base.AttachmentMixin" class="py-name" href="#" onclick="return doclink('link-36', 'AttachmentMixin', 'link-36');">AttachmentMixin</a></tt><tt class="py-op">,</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt id="link-37" class="py-name" targets="Class couchdbkit.ext.django.schema.Document=couchdbkit.ext.django.schema.Document-class.html,Class couchdbkit.schema.base.Document=couchdbkit.schema.base.Document-class.html"><a title="couchdbkit.ext.django.schema.Document
couchdbkit.schema.base.Document" class="py-name" href="#" onclick="return doclink('link-37', 'Document', 'link-37');">Document</a></tt><tt class="py-op">,</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">        <tt id="link-38" class="py-name" targets="Class couchdbkit.schema.base.StaticDocument=couchdbkit.schema.base.StaticDocument-class.html"><a title="couchdbkit.schema.base.StaticDocument" class="py-name" href="#" onclick="return doclink('link-38', 'StaticDocument', 'link-38');">StaticDocument</a></tt><tt class="py-op">,</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">        <tt id="link-39" class="py-name" targets="Function couchdbkit.schema.base.valid_id()=couchdbkit.schema.base-module.html#valid_id"><a title="couchdbkit.schema.base.valid_id" class="py-name" href="#" onclick="return doclink('link-39', 'valid_id', 'link-39');">valid_id</a></tt><tt class="py-op">)</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-op">.</tt><tt id="link-40" class="py-name" targets="Module couchdbkit.schema.properties_proxy=couchdbkit.schema.properties_proxy-module.html"><a title="couchdbkit.schema.properties_proxy" class="py-name" href="#" onclick="return doclink('link-40', 'properties_proxy', 'link-40');">properties_proxy</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">(</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">        <tt id="link-41" class="py-name" targets="Class couchdbkit.schema.properties_proxy.SchemaProperty=couchdbkit.schema.properties_proxy.SchemaProperty-class.html"><a title="couchdbkit.schema.properties_proxy.SchemaProperty" class="py-name" href="#" onclick="return doclink('link-41', 'SchemaProperty', 'link-41');">SchemaProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">        <tt id="link-42" class="py-name" targets="Class couchdbkit.schema.properties_proxy.SchemaListProperty=couchdbkit.schema.properties_proxy.SchemaListProperty-class.html"><a title="couchdbkit.schema.properties_proxy.SchemaListProperty" class="py-name" href="#" onclick="return doclink('link-42', 'SchemaListProperty', 'link-42');">SchemaListProperty</a></tt><tt class="py-op">,</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">        <tt id="link-43" class="py-name" targets="Class couchdbkit.schema.properties_proxy.SchemaDictProperty=couchdbkit.schema.properties_proxy.SchemaDictProperty-class.html"><a title="couchdbkit.schema.properties_proxy.SchemaDictProperty" class="py-name" href="#" onclick="return doclink('link-43', 'SchemaDictProperty', 'link-43');">SchemaDictProperty</a></tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line"> </tt>
<a name="contain"></a><div id="contain-def"><a name="L208"></a><tt class="py-lineno">208</tt> <a class="py-toggle" href="#" id="contain-toggle" onclick="return toggle('contain');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="couchdbkit.schema-module.html#contain">contain</a><tt class="py-op">(</tt><tt class="py-param">db</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-param">docs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="contain-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="contain-expanded"><a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">    <tt class="py-docstring">""" associate a db to multiple `Document` class"""</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt id="link-44" class="py-name" targets="Method couchdbkit.designer.fs.FSDoc.doc()=couchdbkit.designer.fs.FSDoc-class.html#doc"><a title="couchdbkit.designer.fs.FSDoc.doc" class="py-name" href="#" onclick="return doclink('link-44', 'doc', 'link-44');">doc</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">docs</tt><tt class="py-op">:</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt id="link-45" class="py-name"><a title="couchdbkit.designer.fs.FSDoc.doc" class="py-name" href="#" onclick="return doclink('link-45', 'doc', 'link-44');">doc</a></tt><tt class="py-op">,</tt> <tt class="py-string">'_db'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">            <tt id="link-46" class="py-name"><a title="couchdbkit.designer.fs.FSDoc.doc" class="py-name" href="#" onclick="return doclink('link-46', 'doc', 'link-44');">doc</a></tt><tt class="py-op">.</tt><tt id="link-47" class="py-name" targets="Variable couchdbkit.schema.base.DocumentBase._db=couchdbkit.schema.base.DocumentBase-class.html#_db,Variable couchdbkit.schema.base.DocumentSchema._db=couchdbkit.schema.base.DocumentSchema-class.html#_db"><a title="couchdbkit.schema.base.DocumentBase._db
couchdbkit.schema.base.DocumentSchema._db" class="py-name" href="#" onclick="return doclink('link-47', '_db', 'link-47');">_db</a></tt> <tt class="py-op">=</tt> <tt id="link-48" class="py-name" targets="Module couchdbkit.ext.pylons.db=couchdbkit.ext.pylons.db-module.html"><a title="couchdbkit.ext.pylons.db" class="py-name" href="#" onclick="return doclink('link-48', 'db', 'link-48');">db</a></tt> </tt>
</div><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="couchdbkit-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Fri May  4 11:48:42 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
